package com.hongxun.design.utils;

import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;

/**
 * Created by admin on 2017/12/25.
 */

public class DialogUtils {

    public static void showMsgDialog(Context c, String title, String msg, final DialogInterface.OnClickListener listener){
        /* @setIcon 设置对话框图标
         * @setTitle 设置对话框标题
         * @setMessage 设置对话框消息提示
         * setXXX方法返回Dialog对象，因此可以链式设置属性
         */
        final AlertDialog.Builder normalDialog =
                new AlertDialog.Builder(c);
        normalDialog.setTitle(title);
        normalDialog.setMessage(msg);
        normalDialog.setPositiveButton("确定",listener);
        normalDialog.setNegativeButton("关闭",null);
        normalDialog.show();
    }
    public static void showMsgDialog(Context c, String title, String msg,String positiveMsg,String negativeMsg, final DialogInterface.OnClickListener positiveListener, final DialogInterface.OnClickListener negativeListener){
        /* @setIcon 设置对话框图标
         * @setTitle 设置对话框标题
         * @setMessage 设置对话框消息提示
         * setXXX方法返回Dialog对象，因此可以链式设置属性
         */
        final AlertDialog.Builder normalDialog =
                new AlertDialog.Builder(c);
        normalDialog.setTitle(title);
        normalDialog.setMessage(msg);
        normalDialog.setPositiveButton(positiveMsg,positiveListener);
        normalDialog.setNegativeButton(negativeMsg,negativeListener);
        normalDialog.show();
    }

}
